package com.ruoyi.common.core.domain.entity;

import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.annotation.Excel.ColumnType;
import com.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Set;

/**
 * 投喂机表 sys_water
 *
 * @author xiongdong
 */
public class SysWater extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 投喂机ID
     */
    @Excel(name = "增氧机序号", cellType = ColumnType.NUMERIC)
    private Long waterId;

    /**
     * 投喂机名称
     */
    @Excel(name = "增氧机名称")
    private String waterName;

    /**
     * 投喂机权限
     */
    @Excel(name = "增氧机权限")
    private String waterKey;

    /**
     * 投喂机排序
     */
    @Excel(name = "增氧机排序")
    private Integer waterSort;

    /**
     * 数据范围（1：所有数据权限；2：自定义数据权限；3：本渔场数据权限；4：本渔场及以下数据权限；5：仅本人数据权限）
     */
    @Excel(name = "数据范围", readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本渔场数据权限,4=本渔场及以下数据权限,5=仅本人数据权限")
    private String dataScope;

    /**
     * 菜单树选择项是否关联显示（ 0：父子不互相关联显示 1：父子互相关联显示）
     */
    private boolean menuCheckStrictly;

    /**
     * 渔场树选择项是否关联显示（0：父子不互相关联显示 1：父子互相关联显示 ）
     */
    private boolean deptCheckStrictly;

    /**
     * 增氧机状态（0正常 1停用）
     */
    @Excel(name = "增氧机状态", readConverterExp = "0=正常,1=停用")
    private String status;

    /**
     * 删除标志（0代表存在 2代表删除）
     */
    private String delFlag;

    /**
     * 用户是否存在此增氧机标识 默认不存在
     */
    private boolean flag = false;

    /**
     * 菜单组
     */
    private Long[] menuIds;

    /**
     * 渔场组（数据权限）
     */
    private Long[] deptIds;

    /**
     * 增氧机菜单权限
     */
    private Set<String> permissions;

    public SysWater() {

    }

    public SysWater(Long waterId) {
        this.waterId = waterId;
    }

    public Long getWaterId() {
        return waterId;
    }

    public void setWaterId(Long waterId) {
        this.waterId = waterId;
    }

    public boolean isAdmin() {
        return isAdmin(this.waterId);
    }

    public static boolean isAdmin(Long waterId) {
        return waterId != null && 1L == waterId;
    }

    @NotBlank(message = "增氧机名称不能为空")
    @Size(min = 0, max = 30, message = "增氧机名称长度不能超过30个字符")
    public String getWaterName() {
        return waterName;
    }

    public void setWaterName(String waterName) {
        this.waterName = waterName;
    }

    @NotBlank(message = "权限字符不能为空")
    @Size(min = 0, max = 100, message = "权限字符长度不能超过100个字符")
    public String getWaterKey() {
        return waterKey;
    }

    public void setWaterKey(String waterKey) {
        this.waterKey = waterKey;
    }

    @NotNull(message = "显示顺序不能为空")
    public Integer getWaterSort() {
        return waterSort;
    }

    public void setWaterSort(Integer waterSort) {
        this.waterSort = waterSort;
    }

    public String getDataScope() {
        return dataScope;
    }

    public void setDataScope(String dataScope) {
        this.dataScope = dataScope;
    }

    public boolean isMenuCheckStrictly() {
        return menuCheckStrictly;
    }

    public void setMenuCheckStrictly(boolean menuCheckStrictly) {
        this.menuCheckStrictly = menuCheckStrictly;
    }

    public boolean isDeptCheckStrictly() {
        return deptCheckStrictly;
    }

    public void setDeptCheckStrictly(boolean deptCheckStrictly) {
        this.deptCheckStrictly = deptCheckStrictly;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getDelFlag() {
        return delFlag;
    }

    public void setDelFlag(String delFlag) {
        this.delFlag = delFlag;
    }

    public boolean isFlag() {
        return flag;
    }

    public void setFlag(boolean flag) {
        this.flag = flag;
    }

    public Long[] getMenuIds() {
        return menuIds;
    }

    public void setMenuIds(Long[] menuIds) {
        this.menuIds = menuIds;
    }

    public Long[] getDeptIds() {
        return deptIds;
    }

    public void setDeptIds(Long[] deptIds) {
        this.deptIds = deptIds;
    }

    public Set<String> getPermissions() {
        return permissions;
    }

    public void setPermissions(Set<String> permissions) {
        this.permissions = permissions;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("waterId", getWaterId())
                .append("waterName", getWaterName())
                .append("waterKey", getWaterKey())
                .append("waterSort", getWaterSort())
                .append("dataScope", getDataScope())
                .append("menuCheckStrictly", isMenuCheckStrictly())
                .append("deptCheckStrictly", isDeptCheckStrictly())
                .append("status", getStatus())
                .append("delFlag", getDelFlag())
                .append("createBy", getCreateBy())
                .append("createTime", getCreateTime())
                .append("updateBy", getUpdateBy())
                .append("updateTime", getUpdateTime())
                .append("remark", getRemark())
                .toString();
    }
}
